#ifndef _MATRIXSTACK_H
#define _MATRIXSTACK_H

#include <d3dx9math.h>
#include <stack>

class MatrixStack
{
public:
	static void Create();
	static MatrixStack *ReturnInstance();
	static void Delete();

	void Push(const D3DXMATRIX &matrix);
	void Pop();

	D3DXMATRIX ReturnTop(){return m_matrixStack.top();}

	//Sets the view matrix, but doesn't change the top value
	void SetViewMatrix(const D3DXMATRIX &viewMatrix);
	//Sets the projection matrix, but doesn't change the top value
	void SetProjectionMatrix(const D3DXMATRIX &projectionMatrix);
	//Sets the world matrix and alters the top value
	void SetWorldMatrix(const D3DXMATRIX &worldMatrix);

private:
	MatrixStack(); //Singelton - Private Constructor
	static MatrixStack *g_instance;

	std::stack<D3DXMATRIX> m_matrixStack;

	D3DXMATRIX m_viewMatrix;
	D3DXMATRIX m_projectionMatrix;
	D3DXMATRIX m_worldMatrix;
};

#endif